package palms.idserver;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class IdServer {

	public static void main(String[] args) {
		
		IdLogic il = new IdLogic();
		
		try {
			System.out.println("####");
			System.out.println("Identification Server is online.");
			System.out.println("####");
			System.out.println("-->Waiting for requests...");
			ServerSocket ssocket = new ServerSocket(il.getSiport());
			while(true){
				Socket s = ssocket.accept();
				System.out.println("-->Received a connection...");
				IdWorker worker = new IdWorker(s, il);
				Thread t = new Thread(worker);
				t.start();
				System.out.println("-->Launched a worker to process message...");
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
